package com.ruoyi.yuanliao.controller;

import com.lcb.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @projectName: blockchain-fabric-group1
 * @package: com.ruoyi.yuanliao.controller
 * @className: FileController
 * @author: 刘乘滨
 * @description: TODO
 * @date: 2023/05/22 20:01
 * @version: 1.0
 */
@RestController
@RequestMapping("/changshang/file")
@CrossOrigin
public class FileController {

    @Autowired
    UploadService uploadService;

    @PostMapping("/upload")
    public String upload(@RequestBody MultipartFile file) throws IOException {

        String pic = uploadService.pic(file);
        System.err.println(pic);
        return pic;
    }
}
